package com.xy.sqldoc.runner;

import com.xy.sqldoc.dto.ExportDto;
import com.xy.sqldoc.enums.ExportType;
import com.xy.sqldoc.service.DatabaseDocService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

@Component
public class DocGeneratorRunner implements ApplicationRunner {

    private final DatabaseDocService databaseDocService;

    @Autowired
    public DocGeneratorRunner(DatabaseDocService databaseDocService) {
        this.databaseDocService = databaseDocService;
    }

    @Override
    public void run(ApplicationArguments args) {
        // 启动时生成数据库文档
        ExportDto exportDto = new ExportDto();
        exportDto.setExportType(ExportType.MD);
        exportDto.setFileName("aa.md");
        databaseDocService.generateDatabaseDoc(exportDto);
    }

}